package com.inepex.inechart.client.interactivity;

import com.google.gwt.event.shared.GwtEvent;

public class FilteredDragEvent extends GwtEvent<FilteredDragEventHandler> {
	
	public static final Type<FilteredDragEventHandler> TYPE = new Type<FilteredDragEventHandler>();
	
	public enum DragEventType{
		Start,
		End,
		To
	}
	
	protected final DragEventType eventType;
	protected final int[] coords;
	
	public FilteredDragEvent(DragEventType eventType, int[] coords) {
		this.eventType = eventType;
		this.coords = coords;
	}

	@Override
	protected void dispatch(FilteredDragEventHandler handler) {
		switch (eventType) {
		case Start:
			handler.onDragStart(this);
			break;
		case End:
			handler.onDragEnd(this);
			break;
		default:
			handler.onDragTo(this);
			break;
		}
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<FilteredDragEventHandler> getAssociatedType() {
		return TYPE;
	}

	public DragEventType getEventType() {
		return eventType;
	}

	public final int[] getCoords() {
		return coords;
	}

	

}
